import { CommonResponse } from "@/types";
import axios, { AxiosResponse } from "axios";
const BASE_URL = "/api";
const request = axios.create({
    baseURL: BASE_URL,
    timeout: 300000,
});

request.interceptors.response.use((response: AxiosResponse<CommonResponse>) => {
    const { data } = response;
    if (data.code === 0) {
        return data.data;
    } else {
        return Promise.reject(data.msg);
    }
});

export default request;
